<%@page contentType="text/html;charset=utf-8" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>收件箱</title>
    <link rel="icon" href="../favicon.ico" type="image/ico">
    <link href="${base}/css/bootstrap.min.css" rel="stylesheet">
    <link href="${base}/css/materialdesignicons.min.css" rel="stylesheet">
    <link href="${base}/css/style.min.css" rel="stylesheet">
    <link href="${base}/css/animate.css" rel="stylesheet">
    <style>
        img {
            width: 50px;
            height: 50px;
            border-radius: 50px;
        }
    </style>
</head>

<body>
<div class="topbar" style="background-color: deepskyblue;opacity: 0.5">
    <div class="topbar-left">
        <div class="lyear-aside-toggler">
        </div>
        <span class="navbar-page-title" style="margin-left: 80px"> <h3 style="color: black">垃圾箱</h3> </span>
    </div>
    <ul class="topbar-right">
        <li class="dropdown dropdown-profile">
            <img style="display: inline-block" class="img-avatar img-avatar-48 m-r-10" src="${base}/upload/${theUser.headpic}" />
            <span style="color: crimson">${theUser.name}</span>
            <a style="display: inline-block;color: black" href="${base}/toHome">回到首页</a>
        </li>
    </ul>
</div>
<div class="container-fluid">
    <div class="row">
        <div class="col-lg-12" style="background-image: url(${base}/img/444.jpg);background-size: 120%">
            <div class="card" style="width: 1200px;height: 800px;margin-left:auto;margin-right:auto;opacity: 0.9">
                <div>
                    <form method="get" action="${base}/information/selectLjx">
                        <div class="input-group">
                            <input type="text" class="form-control" value="" name="likes" placeholder="根据电话或者发送方姓名搜索"
                                   style="width: 230px;margin-top: 30px;margin-left: 25px; ">
                            <button class="btn btn-cyan btn-w-md" type="submit" style="margin-top: 30px;width: 100px"
                            >搜索
                            </button>
                            <input type="hidden" name="search_field" id="search-field" value="title">
                        </div>
                    </form>
                </div>

                <div class="card-toolbar clearfix">
                    <div class="toolbar-btn-action">
                        <a class="btn btn-primary m-r-5" href="${base}/friends/selectAllfs"></i>我的好友</a>
                        <a class="btn btn-primary m-r-5" href="${base}/information/selectAllInfs"> 收件箱</a>
                        <a class="btn btn-primary m-r-5" href="${base}/information/updateAllAcceptStateinLjx">全部恢复到收件箱</a>
                        <a class="btn btn-danger" onclick="allDeletess()">全部彻底删除</a>
                    </div>
                </div>

                <div class="card-body">

                    <div class="table-responsive">
                        <form action="" method="post" id="form4">
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th>
                                        <label class="lyear-checkbox checkbox-primary">
                                            <input type="checkbox" id="check-all"><span></span>
                                        </label>
                                    </th>
                                    <td>编号</td>
                                    <th>发件人</th>
                                    <th>账号</th>
                                    <th>手机号</th>
                                    <th>标题</th>
                                    <th>时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <c:forEach var="i" items="${p.list}">
                                    <tr>
                                        <td>
                                            <label class="lyear-checkbox checkbox-primary">
                                                <input type="checkbox" name="cks" value="${i.id}"><span></span>
                                            </label>
                                        </td>
                                        <td>${i.id}</td>
                                        <td>${i.user1.name}</td>
                                        <td>${i.user1.account}</td>
                                        <td>${i.user1.phone}</td>
                                        <td>${i.title}</td>
                                        <td><fmt:formatDate value="${i.createtime}"
                                                            pattern="yy-MM-dd HH:mm:ss"></fmt:formatDate></td>


                                        <td>
                                            <div class="btn-group">
                                                <div class="btn-group btn-group-round">
                                                    <a class="btn btn-default"
                                                       onclick="(function() {
                                                               lightyear.loading('show');
                                                               setTimeout(function () {
                                                               lightyear.loading('hide');
                                                               lightyear.notify('已恢复到收件箱~', 'success', 1000);
                                                               }, 0)
                                                               setTimeout(function() {
                                                               $('#form4').attr('action','${base}/information/updateAcceptStateinLjx?id=${i.id}');
                                                               $('#form4').submit();
                                                               },500)
                                                               })()">恢复到收件箱</a>
                                                    <a class="btn btn-default"
                                                       onclick="(function() {
                                                               lightyear.loading('show');
                                                               setTimeout(function () {
                                                               lightyear.loading('hide');
                                                               lightyear.notify('已彻底删除~', 'success', 1000);
                                                               }, 0)
                                                               setTimeout(function() {
                                                               $('#form4').attr('action','${base}/information/deleteInfs?id=${i.id}&type=1');
                                                               $('#form4').submit();
                                                               },500)
                                                               })()"
                                                    >彻底删除</a>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </c:forEach>
                                </tbody>
                            </table>
                        </form>
                    </div>
                    <ul class="pagination">
                        <li><a href="${base}/information/selectLjx?pageNum=1&likes=${likes}">«</a></li>
                        <li><a href="${base}/information/selectLjx?pageNum=${p.prePage}&likes=${likes}">上一页</a></li>
                        <c:forEach var="i" items="${p.navigatepageNums}">
                            <li <c:if test="${i eq p.pageNum}">class="active"</c:if>><a
                                    href="${base}/information/selectLjx?pageNum=${i}&likes=${likes}">${i}</a></li>
                        </c:forEach>
                        <li><a href="${base}/information/selectLjx?pageNum=${p.nextPage}&likes=${likes}">下一页</a>
                        </li>
                        <li><a href="${base}/information/selectLjx?pageNum=${p.pages}&likes=${likes}">»</a></li>
                    </ul>

                </div>
            </div>
        </div>

    </div>

</div>

<script type="text/javascript" src="${base}/js/jquery.min.js"></script>
<script type="text/javascript" src="${base}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${base}/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="${base}/js/main.min.js"></script>

<script src="${base}/js/bootstrap-notify.min.js"></script>
<script type="text/javascript" src="${base}/js/lightyear.js"></script>
<script type="text/javascript" src="${base}/js/main.min.js"></script>
<script type="text/javascript">
    $(function () {
        $('.search-bar .dropdown-menu a').click(function () {
            var field = $(this).data('field') || '';
            $('#search-field').val(field);
            $('#search-btn').html($(this).text() + ' <span class="caret"></span>');
        });
    });
    document.onclick = function (event) {
        if (!box.contains(event.target) && mybtn != event.target) {
            box.hidden = true;
        }
    }
    function allUpdate() {
        $("#form4").attr("action","${base}/information/updateAllAcceptState");
        $("#form4").submit();
    }
    function allDeletess() {
        $("#form4").attr("action","${base}/information/deleteAllInfs?type=2");
        $("#form4").submit();
    }

</script>
</body>
</html>